﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Model;
using TakeoutMangesBLL;

namespace TakeoutMangesWeb
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Model.UserInfo US=new Model.UserInfo();
            US.UserName= txtname.Value.Trim();
            US.Password =Convert.ToInt32(txtpwd.Value.Trim());
            US.UserSex =Convert.ToInt32(RBsex.SelectedValue);
            US.UserTel =txtTel.Value.Trim();
            US.UserAdress = txtAress.Value.Trim();
            US.Isdelete = 0;
            int r= UserInfoBLL.UserRegister(US);
            if (r > 0)
            {
                Response.Write("<script>alert('注册成功');window.location.href='Login.aspx';</script>");
            }
            else 
            {
                Response.Write("<script>alert('发生错误，注册失败');</script>");
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("Login.aspx");
        }
    }
}